<template>
	<view class="container">
		<view class="select-plate">
			<image src="../../../static/images/successful.png" mode="" class="success-img"></image>
		</view>
		<view class="text">支付成功</view>
		<view class="box">温馨提示:请您在三分钟内驶离,避免产生额外费用</view>
		<button type="primary" :style="btn_style" class="btn" @tap="uPublishTap">返回</button>
		<view class="ad-card">
			<image src="../../../static/images/bg.png" mode="" class="ad-img"></image>
		</view>
	</view>
</template>

<script>
	var common = require('../../../utils/common.js');
	var app = getApp();
	var _this;
	const gettaskList = () => {
		common.post('HouseApi&a=my_task_list', {
			page: 1,
		}, data => {
			console.log('++++', data)
			_this.listdata = data.task_list;
		});
	};
	export default {
		data() {
			return {
				listdata: {},
				numlist: {},
				village_id: 0,
				pigcms_id: 0,
				actcolor: '',
				btn_style: '',
				show: true,
				Num: '皖AN7A254',
				nihao: '',
				seconds:10,
				minutes:0,
			}
		},
		onShow() {
			// #ifdef H5
			common.hideWxShare()
			// #endif
		},
		onLoad(options) {
			_this = this;
			_this.minutes = options.free_out_time;
			_this.village_id = options.village_id;
			_this.add()
			// #ifdef H5
			console.log('准备跳小程序页', _this.id);
			common.webToMiniapp(_this.route, options, 'redirect')
			// #endif

			common.setMainColor(_this, function(config) {
				_this.actcolor = config.config.mobile_head_color
				_this.btn_style = 'background-color: ' + _this.actcolor + ';box-shadow:0px 30rpx 30rpx -30rpx ' + _this.actcolor +
					';';

				const res = uni.getStorageSync('village_key');
				if (res) {
					_this.village_id = res.village_id;
					_this.pigcms_id = res.pigcms_id;
					_this.village_name = res.village_name;
				};
				// getaddress()
				// gettaskMaplist()
			});
		},
		methods: {
			num: function(n) {
				return n < 10 ? '0' + n : '' + n
			},
			add: function() {
				let _self = _this
				var time = window.setInterval(function() {
					if (_self.seconds === 0 && _self.minutes !== 0) {
						_self.seconds = 59
						_self.minutes -= 1
					} else if (_self.minutes === 0 && _self.seconds === 0) {
						_self.seconds = 0
						window.clearInterval(time)
					} else {
						_self.seconds -= 1
					}
				}, 1000)
			},
			uPublishTap() {
				uni.navigateTo({
					url: '/pages/village/smartPark/paymentSuccessful'
				})
			}
		},
		watch: {
			second: {
				handler(newVal) {
					this.num(newVal)
				}
			},
			minute: {
				handler(newVal) {
					this.num(newVal)
				}
			}
		},
		computed: {
			second: function() {
				return this.num(this.seconds)
			},
			minute: function() {
				return this.num(this.minutes)
			}
		},
		components: {
			
		}
	}
</script>

<style>
	page {
		background: rgb(245, 245, 245);
	}

	.container {
		margin: 0;
		padding: 0;
		height: 100%;
	}

	.select-plate {
		width: 150rpx;
		height: 150rpx;
		margin: 50rpx auto;
	}
	.success-img {
		width: 100%;
		height: 100%;
		display: block;
	}

	.plate-box {
		margin: 15rpx;
		display: flex;
		flex-direction: row;
		flex-wrap: wrap;
		border-bottom: 2rpx solid #F1F1F1;
	}

	.plate {
		padding: 2rpx 10rpx;
		background: #CCCCCC;
		color: rgb(160, 160, 160);
		margin-left: 15rpx;
		margin-top: 15rpx;
	}
	.btn {
		margin: 50rpx 150rpx;
		font-size: 24rpx;
		line-height: 70rpx;
		border-radius: 50rpx;
	}
	.box {
		font-size: 28rpx;
		color: #CCCCCC;
		text-align: center;
		margin-top: 20rpx;
	}
	.text {
		font-size: 32rpx;
		font-weight: 700;
		text-align: center;
	}
	.ad-card {
		margin-top: 50rpx;
		width: 100%;
		height: 400rpx;
	}
	.ad-img {
		width: 100%;
		height: 100%;
	}
</style>
